<extend name="Config/base"/>

<block name="body">
<script>
    function center_toggle(name) {
        var show = $('#' + name + '_panel').css('display');
        $('.center_panel').hide();
        $('.center_arrow_right').show();
        $('.center_arrow_bottom').hide()
        if (show == 'none') {
            $('#' + name + '_panel').show();
            $('#' + name + '_toggle_right').hide();
            $('#' + name + '_toggle_bottom').show()
        } else {
            $('#' + name + '_toggle_right').show();
            $('#' + name + '_toggle_bottom').hide()
        }

    }
</script>
<div id="center">
<div id="center_base">
<div class="with-padding">


<div id="center_account">
    <div class="row">
        <div class="col-xs-12">
            <h4 onclick="center_toggle('account')"><i class="icon-list-alt"></i>&nbsp;账户资料

                <a class="pull-right" id="toggle_account"
                        >
                    编辑
                    <i id="account_toggle_right" title="展开" class="center_arrow_right"></i>
                    <i id="account_toggle_bottom" title="收起" class="center_arrow_bottom"
                       style="display: none"></i>
                </a>
            </h4>
            <hr class="center_line"/>
        </div>
    </div>

    <div id="account_panel" class="row center_panel">
        <div class="col-md-8 center_info form-horizontal">

    <php>if(check_reg_type('username')){</php>
            <div class="form-group">
                <label for="aUsername" class="col-sm-2 control-label">用户名</label>

                <div class="col-sm-10">
                    <php>if($accountInfo['username']){</php>
                    <span class="lh32">{$accountInfo['username']}</span>
                    <php>}else{</php>
                    <input type="text" class="form-control pull-left" id="aUsername" value=""
                           placeholder="还未设置用户名，赶快来设置吧~">
                    <a class="pull-left lh32 saveUsername" style="margin-left: 10px">设置</a>
                    <script>
                        $(function () {
                            $('.saveUsername').click(function () {
                                var username = $(this).prev().val();
                                if (!username) {
                                    toast.error('用户名不能为空！');
                                    return false;
                                }
                                if (confirm('用户名一经设置就不能修改，确定要设置么？')) {
                                    $.post("{:U('ucenter/config/saveUsername')}", {username: username}, function (res) {
                                        handleAjax(res);
                                    })
                                }
                            })
                        })
                    </script>
                    <php>}</php>
                </div>
            </div>

            <php>}</php>

            <php>if(check_reg_type('email')){</php>
            <div class="form-group">
                <label for="aEmail" class="col-sm-2 control-label">邮箱</label>

                <div class="col-sm-10">
                    <input type="email" class="form-control pull-left" id="aEmail" placeholder="邮箱" value="{$accountInfo.email}">
                    <a class="pull-left lh32 " style="margin-left: 10px" data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'email'))}" data-toggle="modal">修改邮箱</a>
                </div>
            </div>
            <php>}</php>

            <php>if(check_reg_type('mobile')){</php>

            <div class="form-group">
                <label for="aMobile" class="col-sm-2 control-label">手机</label>

                <div class="col-sm-10">
                    <input type="text" class="form-control pull-left" id="aMobile" placeholder="手机" value="{$accountInfo.mobile}">
                    <a class="pull-left lh32 " style="margin-left: 10px" data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'mobile'))}" data-toggle="modal">修改手机</a>
                </div>
            </div>
            <php>}</php>
        </div>

    </div>

</div>


<div class="row">
    <div class="col-xs-12">
        <h4 onclick="center_toggle('base')"><i class="icon-list-alt"></i>&nbsp;基本资料
            <a class="pull-right" id="toggle_base">
                编辑
                <i id="base_toggle_right" title="展开" class="center_arrow_right"
                   style="display: none"></i>
                <i id="base_toggle_bottom" title="收起" class="center_arrow_bottom"></i>
            </a>

        </h4>
        <hr class="center_line"/>
    </div>
</div>

<div class="row center_panel" id="base_panel" style="display: none">
    <div class="col-md-8">
        <form class="form-horizontal center_info ajax-form" role="form"
              action="{:U('Ucenter/Config/index')}" method="post">
            <div class="form-group">
                <label for="nickname" class="col-sm-2 control-label">昵称</label>

                <div class="col-sm-10">
                    <input type="text" class="form-control" id="nickname" name="nickname"
                           value="{$user.nickname|op_t}"
                           placeholder="昵称">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">性别</label>

                <div class="col-sm-10">
                    <label class="radio-inline">
                        <input name="sex" type="radio" value="1"
                        <eq name="user.sex" value="1"> checked</eq>
                        > 男
                    </label>
                    <label class="radio-inline">
                        <input name="sex" type="radio" value="2"
                        <eq name="user.sex" value="2"> checked</eq>
                        > 女
                    </label>
                    <label class="radio-inline">
                        <input name="sex" type="radio" value="0"
                        <eq name="user.sex" value="0"> checked</eq>
                        > 保密
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label for="email" class="col-sm-2 control-label">邮箱</label>

                <div class="col-sm-10">
                    <input type="email" class="form-control" id="email" placeholder="邮箱" name="email"
                           value="{$user.email|htmlspecialchars}">
                </div>
            </div>


            <div class="form-group position">
                <label for="email" class="col-sm-2 control-label">所在地</label>

                <div class="col-sm-10">
                    {:hook('J_China_City',array('province'=>$user['pos_province'],'city'=>$user['pos_city'],'district'=>$user['pos_district'],'community'=>$user['pos_community']))}
                </div>
            </div>
            <div class="form-group">
                <label for="signature" class="col-sm-2 control-label">个性签名</label>

                <div class="col-sm-10">
                    <textarea id="signature" name="signature" class="form-control"
                              style="width: 100%; height: 6em;resize: none">{$user.signature|htmlspecialchars}</textarea>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </div>
        </form>
    </div>
</div>

<div id="center_expandinfo">
    <div class="row">
        <div class="col-xs-12">
            <h4 onclick="center_toggle('expand')"><i class="icon-list-alt"></i>&nbsp;扩展资料

                <a class="pull-right" id="toggle_expand"
                        >
                    编辑
                    <i id="expand_toggle_right" title="展开" class="center_arrow_right"></i>
                    <i id="expand_toggle_bottom" title="收起" class="center_arrow_bottom"
                       style="display: none"></i>
                </a>
            </h4>
            <hr class="center_line"/>
        </div>
    </div>

    <div id="expand_panel" class="center_panel" style="display: none">
        <ul class="nav nav-pills ucenter_tab">
            <volist name="profile_group_list" id="vl">
                <li
                <eq name="vl.id" value="$profile_group_id">class="active"</eq>
                ><a onclick="$('#expandinfo_list').load($(this).attr('url'));$('.ucenter_tab li').removeClass('active');$(this).parent().addClass('active');"
                    url="{:U('Ucenter/Config/showExpandInfo',array('profile_group_id'=>$vl['id'],'uid'=>$uid))}">{$vl.profile_name}</a></li>
            </volist>
        </ul>
        <div class="row">
            <div class="col-md-12">
                <div id="expandinfo_list" class="row expandinfo-list">
                    <include file="Config/expandinfo"/>
                </div>
            </div>
        </div>

    </div>

</div>

<div id="center_avatar">
    <div class="row">
        <div class="col-xs-12">
            <h4 onclick="center_toggle('avatar')"><i class="icon-user"></i>&nbsp;修改头像
                <a class="pull-right" id="toggle_avatar">
                    编辑
                    <i id="avatar_toggle_right" title="展开" class="center_arrow_right"></i>
                    <i id="avatar_toggle_bottom" title="收起" class="center_arrow_bottom"
                       style="display: none"></i>
                </a>
            </h4>
            <hr class="center_line"/>
            </h4>
        </div>
    </div>
    <div id="avatar_panel" class="center_panel" style="display: none">
        <include file="Config/changeavatar"/>
    </div>
</div>


<div id="center_password">
    <div class="row">
        <div class="col-xs-12">
            <h4 onclick="center_toggle('password')"><i class="icon-lock"></i>&nbsp;修改密码
                <a class="pull-right" id="toggle_password"
                        >
                    编辑
                    <i id="password_toggle_right" title="展开" class="center_arrow_right"></i>
                    <i id="password_toggle_bottom" title="收起" class="center_arrow_bottom"
                       style="display: none"></i>
                </a>
            </h4>
            <hr class="center_line"/>
            </h4>
        </div>
    </div>
    <div id="password_panel" class="center_panel clearfix" style="display: none">
        <include file="Config/changepassword"/>
    </div>
</div>


{:hook('userConfig')}
</div>
</div>


</div>
<neq name="tab" value="">
    <script>
        $(function () {

            center_toggle("{$tab}");
        })
    </script>
</neq>

</block>